package offer;

public class offerII_0006 {
    public int[] twoSum(int[] numbers, int target) {
        int len=numbers.length;
        int left=0;
        int right=len-1;
        int[] result=new int[2];
        while(left<right){
            if(numbers[left]+numbers[right]<target) left++;
            else if(numbers[left]+numbers[right]>target) right--;
            else {
                result[0]=left;
                result[1]=right;
                break;
            }
        }
        return result;
    }
}
